import java.io.*;
import java.net.*;
import java.util.Properties;

public class SendPush

{
	// Attributs
	
	// Constructor
	public SendPush(String nickname, String signature, String msg) throws IOException {
		String urlString = "http://pushme.to/z/ajax/pushme/?nickname="+nickname+
							"&signature="+signature+
							"&message="+msg;
		System.out.println(urlString);
		get(urlString);
		System.out.println("Find sendPush");
	}
	
	// MAIN
	public static void main(String[] args) throws IOException {
		String login = "jannoned";
		String signature = "eConf";
		String message = "Votre conférence commence dans moins de 10 min. Titre: TestConférence";
		message = message.replaceAll(" ", "%20");
		SendPush url = new SendPush(login,signature , message);
	}

	public static String get(String url) throws IOException{
		String source ="";
		URL oracle = new URL(url);
		URLConnection yc = oracle.openConnection();
		BufferedReader in = new BufferedReader(
		new InputStreamReader(
		yc.getInputStream()));
		String inputLine;
		
		while ((inputLine = in.readLine()) != null)
		source +=inputLine;
		in.close();
		return source;
	}
}